package com.lyz.anli;

import java.util.Scanner;

/**
 * 买飞机票 原价1000
 *    输入月份、舱位，购买机票，并返回机购买信息
 * 规则如下：
 *      旺季(12-2月，5-8月)
 *      头等舱9折，经济舱8.5折
 *      其他为淡季
 *      头等舱7折，经济舱6.5折
 */
public class De1mjp {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int piao = 1000;
        System.out.println("请依次输入：月份1~12、舱位(头等舱/经济舱)");
        int yue = scanner.nextInt();
        String zuowei = scanner.next();
        System.out.println("原价："+piao+",月份："+yue+",舱位："+zuowei);
        System.out.println("优惠价"+maipiao(piao,yue,zuowei));
    }
    public static double maipiao(int piao,int yue,String zuowei){
        if(piao<0||yue>12&&yue<0||zuowei==null){
            return -1;
        }
        double youhuijia = -1;
        switch (yue){
            case 12:
            case 1:
            case 2:
            case 5:
            case 6:
            case 7:
            case 8:
                if(zuowei.equals("头等舱")){
                    youhuijia = piao*0.9;
                }else if(zuowei.equals("经济舱")) {
                    youhuijia = piao*0.85;
                }
                return youhuijia;
            case 3:
            case 4:
            case 9:
            case 10:
            case 11:
                if(zuowei.equals("头等舱")){
                youhuijia = piao*0.7;
                }else if(zuowei.equals("经济舱")){
                    youhuijia = piao*0.65;
                }
                return youhuijia;
            default:
                return -1;
        }
    }
}
